import { defHttp } from '@/utils/http/axios';
import { MessageParams, MessageListGetResultModel, MessageModel } from './messageModel';

enum Api {
  MESSAGE_LIST = '/message/page',
  MESSAGE_DELETE = '/message/del',
  MESSAGE_DETAIL = '/message/detail',
}

/**
 * @description: Get sample list value
 */

export const messageListApi = (params: MessageParams) =>
  defHttp.post<MessageListGetResultModel>({
    url: Api.MESSAGE_LIST,
    params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

export const messageDeleteApi = (params: MessageParams) =>
  defHttp.postForm<number>({
    url: Api.MESSAGE_DELETE,
    params,
    headers: {
      // @ts-ignore
    },
  });

export const messageDetailApi = (id: number) =>
  defHttp.get<MessageModel>({
    url: Api.MESSAGE_DETAIL,
    params: { id: id },
    headers: {},
  });
